diff --git a/django/middleware/csrf.py b/django/middleware/csrf.py
index c2a9470ab1..d217e8ab40 100644
--- a/django/middleware/csrf.py
+++ b/django/middleware/csrf.py
@@ -437,15 +437,7 @@ class CsrfViewMiddleware(MiddlewareMixin):
         return self._accept(request)
 
     def process_response(self, request, response):
-        if not getattr(request, 'csrf_cookie_needs_reset', False):
-            if getattr(response, 'csrf_cookie_set', False):
-                return response
-
-        if not request.META.get("CSRF_COOKIE_USED", False):
-            return response
-
-        # Set the CSRF cookie even if it's already set, so we renew
-        # the expiry timer.
-        self._set_token(request, response)
-        response.csrf_cookie_set = True
+        if getattr(request, 'csrf_cookie_needs_reset', False) or (request.META.get("CSRF_COOKIE_USED", False) and not getattr(response, 'csrf_cookie_set', False)):
+            self._set_token(request, response)
+            response.csrf_cookie_set = True
         return response
